<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>アーチモバイル店舗管理</title> 
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"  media="all"/>
	<link rel="stylesheet" href="../layuiadmin/style/admin.css" media="all"/>
  <link rel="stylesheet" href="../layuiadmin/style/font-awesome/css/font-awesome.min.css" media="all"/>
</head>
<style>
	/* 设置图标位置样式 */
	#LAY-system-side-menu .layui-nav-item>a>i{
		position: absolute;
		top: 50%;
		left: 20px;
		margin-top: -24px;
		height: 40px;
		line-height: 40px;
	}
	/* 设置a,ul标签盒子模型 */
	#LAY-system-side-menu .layui-nav .layui-nav-item a,
	:after, 
	:before{
		box-sizing: content-box;
	}
#LAY-system-side-menu>li>a{padding-top:0px;}
a{text-decoration:none;}
#LAY-system-side-menu .layui-nav-child>dd>a,
#LAY_app .layui-nav>li>a{text-decoration:none;}
#DownMenu a{padding-top: 10px;padding-bottom: 10px;}
#DownMenu a:hover{text-decoration:none;}
.layadmin-side-shrink .layui-side-menu .layui-nav > .layui-nav-item:hover .layui-nav-child{
	display: inline-block;
	position: fixed;
	left: 60px;
	min-width: 200px;
	padding: 0;
	width:auto;
}
.layadmin-side-shrink .layui-side-menu .layui-nav > .layui-nav-item:hover cite{
	display:none;
}
.layadmin-side-shrink .layui-side-menu .layui-nav > .layui-nav-item:hover .layui-nav-child a{
	padding-left:20px;
}
.layadmin-side-shrink .layui-side-menu .layui-nav > .layui-nav-item:hover .layui-nav-child i{
	left:-10px;
}
.layadmin-side-shrink .layui-side-menu .layui-nav >.layui-nav-item:hover .layui-nav-child cite{
	display: inline-block;
	width: auto;
	padding: 0;
	text-indent:0;
}
.layui-layout-admin .layui-layout-right{padding:0 20px;}
</style>
</head>
<body class="layui-layout-body">
  
  <div id="LAY_app">
    <div class="layui-layout layui-layout-admin">
      <div class="layui-header">
        <!-- 头部区域 -->
        <ul class="layui-nav layui-layout-left">
          <li class="layui-nav-item layadmin-flexible" lay-unselect>
            <a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
              <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
            </a>
          </li>
         <!--  <li class="layui-nav-item layui-hide-xs" lay-unselect>
            <a href="http://www.layui.com/admin/" target="_blank" title="前台">
              <i class="layui-icon layui-icon-website"></i>
            </a>
          </li>
          <li class="layui-nav-item" lay-unselect>
            <a href="javascript:;" layadmin-event="refresh" title="刷新">
              <i class="layui-icon layui-icon-refresh-3"></i>
            </a>
          </li>
          <li class="layui-nav-item layui-hide-xs" lay-unselect>
            <input type="text" placeholder="搜索..." autocomplete="off" class="layui-input layui-input-search" layadmin-event="serach" lay-action="template/search.html?keywords="> 
          </li> -->
        </ul>
        <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
          
         <!--  <li class="layui-nav-item" lay-unselect>
            <a lay-href="app/message/index.html" layadmin-event="message" lay-text="消息中心">
              <i class="layui-icon layui-icon-notice"></i>  
              
              如果有新消息，则显示小圆点
              <span class="layui-badge-dot"></span>
            </a>
          </li> -->
          <li class="layui-nav-item layui-hide-xs" lay-unselect>
            <a href="javascript:;" layadmin-event="theme">
              <i class="layui-icon layui-icon-theme"></i>
            </a>
          </li>
          <li class="layui-nav-item layui-hide-xs" lay-unselect>
            <a href="javascript:;" layadmin-event="lockScreen">
              <i class="layui-icon layui-icon-password"></i>
            </a>
          </li>
          <li class="layui-nav-item layui-hide-xs" lay-unselect>
            <a href="javascript:;" layadmin-event="fullscreen">
              <i class="layui-icon layui-icon-screen-full"></i>
            </a>
          </li>
          <li class="layui-nav-item" lay-unselect>
            <a href="javascript:;">
              <cite id="account"></cite>
            </a>
            <dl class="layui-nav-child">
             <!--  <dd><a lay-href="set/user/info.html">基本资料</a></dd> -->
              <dd><a layadmin-event="updatePassword">パスワード変更</a></dd>
              <hr>
              <dd layadmin-event="logout" style="text-align: center;"><a>ログアウト</a></dd>
            </dl>
          </li>
          <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-unselect>
            <a href="javascript:;" layadmin-event="more"><i class="layui-icon layui-icon-more-vertical"></i></a>
          </li>
        </ul>
      </div>
      
      <!-- 侧边菜单 -->
      <div class="layui-side layui-side-menu">
        <div class="layui-side-scroll">
          <div class="layui-logo" >
            <span>aachii</span>
          </div>
          <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu">
          </ul>
        </div>
      </div>

      <!-- 页面标签 -->
      <div class="layadmin-pagetabs" id="LAY_app_tabs">
        <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
        <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
        <div class="layui-icon layadmin-tabs-control layui-icon-down">
          <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
            <li class="layui-nav-item" lay-unselect>
              <a href="javascript:;"></a>
              <dl class="layui-nav-child layui-anim-fadein">
                <dd layadmin-event="closeThisTabs"><a href="javascript:;">現在のタブを閉じる</a></dd>
                <dd layadmin-event="closeOtherTabs"><a href="javascript:;">タブを閉じましょう</a></dd>
                <dd layadmin-event="closeAllTabs"><a href="javascript:;">タブ全てを閉じる</a></dd>
              </dl>
            </li>
          </ul>
        </div>
        <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
          <ul class="layui-tab-title" id="LAY_app_tabsheader">
            <li lay-id="" lay-attr="" id="home-menu" class="layui-this"><i class="layui-icon layui-icon-home"></i></li>
          </ul>
        </div>
      </div>
      
      
      <!-- 主体内容 -->
      <div class="layui-body" id="LAY_app_body">
        <div class="layadmin-tabsbody-item layui-show">
         <!--  <iframe src="system/main/mainIndex.html" frameborder="0" class="layadmin-iframe"></iframe> -->
        </div>
      </div>
      
      <!-- 辅助元素，一般用于移动设备下遮罩 -->
      <div class="layadmin-body-shade" layadmin-event="shade"></div>
    </div>
  </div>
<script type="text/javascript" src="../layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="../lib/jQuery-2.2.0.min.js" ></script>
<script type="text/javascript" src="../lib/md5.js"></script>
<script>
layui.config({
	base: '../layuiadmin/' //静态资源所在路径
}).extend({
	index: 'lib/index', //主入口模块
	webplus: '../lib/webplus' //方法模块
}).use([ 'index','webplus'], function() {
	var $ = layui.$, 
	form = layui.form,
	webplus=layui.webplus,
	admin = layui.admin;
	if(webplus.initCheckToken()){
		webplus.doAjax('system/main/loadCardMenu','','','','3',function(res){
			// 赋值用户名
			$("#account").text(localStorage.getItem("loginAccount"));
			// 修改默认页的后缀
			var page = $("#home-menu").attr("lay-id");
			$("#home-menu").attr("lay-id",page+"?token="+webplus.getToken());
			// 缓存按钮权限数据
			localStorage.setItem("buttonGrant",res.data.join(","));
			// 加载菜单
			loadHomeMenu(res.dataList);
		})
	}else{
		
		return false;
	}
	
	//加载主菜单
   function loadHomeMenu(menusData){
	   var parentMenu ='';
	//var parentMenu = '<li data-name="home" class="layui-nav-item"><a lay-href="mainIndex.html" lay-tips="首页" lay-direction="2"><i class="custom-icon fa fa-home"></i><cite>首页</cite></a></li>',
	resData = menusData;
    for(var index=0;index<resData.length;index++){
	// 如果是一级菜单
	if(resData[index].pId == "0" && resData[index].parent) {
		// 组装子菜单 
		var resChildMenu = "";
		// 如果子菜单不为空
		if(resData[index].children != null || resData[index].children.length>0){
			resChildMenu = childMenuMegre(resData[index].children, index);
		}
		var itemed="";
		if(index==0){
			itemed=" layui-nav-itemed "
		}
		var aItem = '<a href="javascript:;" lay-tips="' + resData[index].name + '" lay-direction="2">';
		parentMenu += '<li data-name="home" class="layui-nav-item'+itemed+'">' +aItem+
			'<i class="' + resData[index].icon + '"></i>' +
			'<cite>' + resData[index].name + '</cite>' +
			'<span class="layui-nav-more"></span></a>' +
			resChildMenu +
			'</li>';
	   }
      }
   // 压入数据
     $("#LAY-system-side-menu").html(parentMenu);
     webplus.initMain();
   }
   function childMenuMegre(resData, index){
	   var childMenu = '';
		for(var num=0;num<resData.length;num++){
			// var item = index == 0 && num == 0 ? 'layui-this' : '';
			// childMenu += '<dd data-name="welcome" class="' + item + '">' +
			childMenu += '<dd data-name="welcome">' +
				'<a lay-href="' + resData[num].url + '">' +
				'<i class="' + resData[num].icon + '"></i>' +
				'<cite>' + resData[num].name + '</cite>' +
				'</a>' +
				'</dd>';
		}
		return childMenu == "" ? '':'<dl class="layui-nav-child">' + childMenu + '</dl>';
   }
	// 修改密码
	admin.events.updatePassword = function(){
		webplus.openWindow('system/user/updatePassword.html','パスワード変更','450','230');
	};
	// 退出
	admin.events.logout = function(){
		webplus.doAjax('logout','','ログアウトしますか','0','',function(data){
			webplus.clearLogin(); //清空登陆信息
			window.location.href = webplus.cxt();
		});
	};
	//锁屏
	admin.events.lockScreen = function(){
		sessionStorage.setItem('lockStatus', '1');
		webplus.lockPage(true);
	};
});
</script>
</body>
</html>


